//
//  NSObject+Common.h
//  CodeCollection
//
//  Created by sfpay on 14/12/24.
//  Copyright (c) 2014年 zainxiong. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSObject (Common)

//NSError -> NSString
- (NSString *)tipFromError:(NSError *)error;

//在当前窗口显示错误信息
- (void)showHudTipStr:(NSString *)tipStr;

//在status bar 显示信息
- (void)showStatusBarQueryStr:(NSString *)tipStr;
- (void)showStatusBarSuccessStr:(NSString *)tipStr;
- (void)showStatusBarError:(NSError *)error;

//在status bar 显示进度条
- (void)showStatusBarProgress:(CGFloat)progress;
- (void)hideStatusBarProgress;

//获取本地缓存数据文件的全路径
-(NSString* )pathInCacheDirectory:(NSString *)fileName;

//创建缓存文件夹
-(BOOL) createDirInCache:(NSString *)dirName;

//TODO: repsonse data 的缓存 （本地缓存文件名 = GET请求路径 + 用户Token）
- (BOOL)saveResponseData:(NSDictionary *)data toPath:(NSString *)requestPath;
- (id) loadResponseWithPath:(NSString *)requestPath;
- (BOOL) deleteResponseCache;

//TODO: iamge --> data 的缓存
- (BOOL)saveImage:(UIImage *)image toPath:(NSString *)requestPath;
-(NSData*) loadImageDataWithName:( NSString *)imageName;
- (BOOL) deleteImageCache;

@end
